﻿using IBLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebHouseTypeAPI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HouseTypeController : ControllerBase
    {
        public HouseTypeController(IHouseTypeBLL bLL)
        {
            BLL = bLL;
        }

        public IHouseTypeBLL BLL { get; }

        /// <summary>
        /// 房型添加
        /// </summary>
        /// <param name="houseType"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> AddAsync(HouseType houseType)
        {
            try
            {
                return await BLL.AddAsync(houseType);
            }
            catch (Exception)
            {

                throw;
            }
           
        }
        /// <summary>
        /// 房型预备查
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<HouseType> GetAll()
        {
            try
            {
                return BLL.GetAll();
            }
            catch (Exception)
            {

                throw;
            }
           
        }

    }
}
